<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>24_循环的跳出</title>
</head>
<body>
    <script>
      // 跳出
    //   let index = 0
    //   while(index < 10) {
    //     console.log(`吃包子第${index + 1}`)
    //     if(index === 4) {
    //         break
    //     }
    //    index++
    //   }

      for (let index = 0; index < 10; index++) {
        console.log(`吃包子第${index + 1}`)
        if(index === 4) {
           // continue; // 跳出当前循环 继续下次循环
           break; // 直接跳出循环
        }
      }
    

    </script>
</body>
</html>